<template>
	<view class="supplier">
		<view class="content">
			<view class="header">
				<view class="title">
					<text class="iconfont icon-remen icon"></text>
					<text>热门供应商</text>
				</view>
				<view class="more">
					<text>更多</text>
				</view>
			</view>
			<view class="main">
				<view class="main-wrapper">
					<view class="main-content">
						<view class="item" v-for="item in supplierList">
							<Avatar :size='size' :src='item.logo'></Avatar>
							<view class="item-title">{{item.name}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getSuppliers
	} from '../../api/supplier';
	import Avatar from '../public/avatar/index.vue'
	export default {
		components: {
			Avatar
		},
		data() {
			return {
				size: 'large',
				queryParams: {
					page: 1,
					limit: 10,
				},
				supplierList:[],

			}
		},
		mounted() {
			this.getData();
		},
		methods: {
			async getData() {
				const res = await getSuppliers(this.queryParams);
				if (res.result === 0){
					this.supplierList = res.data.data;
				}
			},
		}
	}
</script>

<style>
	.supplier {
		padding: 0 10px;
	}

	.content {
		background-color: #fff;
		min-height: 210px;
		border-radius: var(--rounded);
		color: #000;
		padding: 8px;
	}

	.header {
		display: flex;
		justify-content: flex-end;
		font-size: 16px;
		padding: 6px;
	}

	.title {
		flex: 1;
		color: var(--color-theme);
	}

	.icon {
		padding: 0 4px;
	}

	.main-content {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-evenly;
		gap: 6px;

	}

	.item {
		width: 60px;
	}


	.item-title {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		font-size: 13px;
        text-align: center;
	}
</style>